package exception;

import java.util.Scanner;

/**
 * try catch
 * @author galen
 */
public class CatchClass {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("学生信息录入");

        String name = "";
        int age = 0;
        String sex = "";
        try {
            System.out.println("请输入学生姓名：");
            name = scanner.next();

            System.out.println("请输入学生年龄：");
            age = scanner.nextInt();

            System.out.println("请输入学生性别：");
            sex = scanner.next();

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("输入有误！");
        }

        System.out.println("姓名：" + name);
        System.out.println("年龄：" + age);
    }
}